package com.zhai.application.cotroller;

import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import com.zhai.application.dal.CommonFlowRuleConfigItemMapper;
import com.zhai.application.entity.InfraFlowRuleItemEntity;
import com.zhai.application.flow.context.DemonContextParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/mybatis")
public class MybatisQueryOomController {

    @Resource
    private CommonFlowRuleConfigItemMapper flowRuleConfigItemMapper;

    @PostMapping("/doCase")
    public JSONObject testConfig(){

        List<Long> configIds = Lists.newArrayList(3L,4L,5L,6L,7L,8L,9L,10L,11L);
        JSONObject result = new JSONObject();
        configIds.forEach(configId->{
            List<InfraFlowRuleItemEntity> listData = flowRuleConfigItemMapper.selectByFlowRuleConfigId(configId);
            result.put(String.valueOf(configId),listData);
        });

        result.put("success",true);
        return result;
    }
}
